<?php
//包含函数库文件
include '../../public/functions.php';
/*
<?php
const WZ_TITLE = '这是一个神奇的网站';
const WZ_LOGO = 'logo.png';
const WZ_COPY = '版权所有:abc';
const WZ_KEY = 'mysql,php,abc';
const WZ_KG = 1;
*/
if($_FILES['WZ_LOGO']['error'] != 4){
	$newfile = upload('WZ_LOGO','../../home/images/');
	suofang('../../home/images/'.$newfile,130,65);
	$_POST['WZ_LOGO'] = $newfile;
}

$str = "<?php\n";
foreach($_POST as $k => $v){
	$str .= "const {$k} = '{$v}';\n";
}

if(file_put_contents('../../public/wzconfig.php',$str)){
	echo '<script>alert("保存成功");window.location.href="edit.php";</script>';
}else{
	echo '<script>alert("保存失败");window.location.href="edit.php";</script>';
}